//
//  SettingTableViewController.m
//  Item
//
//  Created by 刘炳举 on 12/18/15.
//  Copyright © 2015 Kelly. All rights reserved.
//

#import "SettingTableViewController.h"
#import "ChangePwdViewController.h"
#import "ViewController.h"
@interface SettingTableViewController ()

@end

@implementation SettingTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
-(void) viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = YES;//两个都注释：返回首页时返回按钮加载完后才消失
    [self.navigationItem setHidesBackButton:YES];
    self.navigationController.navigationBarHidden = NO;//注释的话在注册界面返回按钮消失
}
- (void)didReceiveMemoryWarning {
    //[super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 2;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    if (indexPath.section==0) {
        switch (indexPath.row) {
            case 0:
                [self changePwd];

                break;
            default:
                break;
        }
    }else if(indexPath.section == 1){
        switch (indexPath.row) {

            case 0:
                [self exitView];
                break;
            default:
                break;
        }

    }
}

-(void)changePwd{
    ChangePwdViewController *toCtrler = [self.storyboard instantiateViewControllerWithIdentifier:@"ChangePwd"];
    [self.navigationController pushViewController:toCtrler animated:NO];
}
-(void)exitView{
    ViewController* view = [[ViewController alloc] init];
    view = [self.storyboard instantiateViewControllerWithIdentifier:@"LoginView"];
    [self.navigationController pushViewController:view animated:NO];

}
@end
